package de.ifi.lmu.snitzelhunt.util;

import java.util.ArrayList;
import java.util.Date;

import de.ifi.lmu.snitzelhunt.basics.ActionTask;
import de.ifi.lmu.snitzelhunt.basics.ImageTask;
import de.ifi.lmu.snitzelhunt.basics.QuizTask;
import de.ifi.lmu.snitzelhunt.basics.Route;
import de.ifi.lmu.snitzelhunt.basics.Task;
import de.ifi.lmu.snitzelhunt.basics.User;

/**
 * Class for creating some simple Testobjects
 * 
 * @author jaschkowitz
 *
 */
public class TestBasics {
	public static void testRoute() {
		Route testroute = createDummyroute();
		String json = GSonUtility.serializeRoute(testroute);

		System.out.println(json);

		Route desRoute = GSonUtility.deserializeRoute(json);

		System.out.println(desRoute);
	}

	public static void testTasks() {
		Route testroute = createDummyroute();
		String json = GSonUtility.serializeTaskList(testroute.getTasks());

		System.out.println(json);

		ArrayList<Task> tasks = GSonUtility.deserializeTaskList(json);

		for (Task t : tasks) {
			System.out.println(t.toString());
		}
	}

	public static void testUser() {
		Route testroute = createDummyroute();
		String json = GSonUtility.serializeUserList(testroute.getUsers());

		System.out.println(json);

		ArrayList<User> users = GSonUtility.deserializeUserList(json);

		for (User us : users) {
			System.out.println(us);
		}
	}

	public static Route createDummyroute() {
		ArrayList<Task> testTasks = new ArrayList<Task>();
		testTasks.add(new QuizTask(12.54692, 48.52465,
				"in welchen Jahr wurde die LMU gegründet?", new String[] {
						"1652", "1756", "1912" }));
		testTasks.add(new ActionTask(12.54548, 48.52111,
				"Schwimme 500m im Eisbach!"));
		testTasks.add(new ImageTask(12.54548, 48.52111,
				"Finde es!", 1));
		ArrayList<User> user = new ArrayList<User>();
		user.add(new User("Anna", "017564958"));
		user.add(new User("Christoph", "017564958"));
		return new Route(1, 0, "MSP", user, "Englischer Garten und München",
				testTasks, new Date(1003445232), new Date());

	}
}
